//
//  CXFirstTableViewCell.m
//  ProjectOfBStage
//
//  Created by cuixin on 15/11/13.
//  Copyright © 2015年 cuixin. All rights reserved.
//

#import "CXFirstTableViewCell.h"
#import "CXFisrtActionColelctionCell.h"
#import "CustomerNetworking.h"
#import "CXInterActionFirstModel.h"

@interface CXFirstTableViewCell ()

@end

@implementation CXFirstTableViewCell
-(void)dealloc{
    [_collectionView release];
    [_array release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.array = [NSMutableArray array];
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
        
//        self.collectionView.collectionViewLayout = flowLayout;
        self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
        flowLayout.minimumInteritemSpacing = 0;
        flowLayout.minimumLineSpacing = 0;
        flowLayout.itemSize = CGSizeMake(200, 100);
        flowLayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);

        flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        self.collectionView.bounces = NO;
        self.collectionView.showsHorizontalScrollIndicator = NO;

        self.collectionView.backgroundColor = [UIColor whiteColor];
        
        [self.collectionView registerClass:[CXFisrtActionColelctionCell class] forCellWithReuseIdentifier:@"CXFisrtActionColelctionCellID"];
        [self.contentView addSubview:self.collectionView];
    }
    return self;

}


-(void)layoutSubviews{
    [super layoutSubviews];
}

-(void)setDataSource:(id<UICollectionViewDataSource>)dataSource{
    [self.collectionView setDataSource:dataSource];
}
-(void)setDelegate:(id<UICollectionViewDelegate>)delegate{
    [self.collectionView setDelegate:delegate];
}

//-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
//    return 0;
//}
//-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
//    return 0;
//}
//-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
//    return CGSizeMake(200, 200);
//}
//-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
//    return UIEdgeInsetsMake(0, 0, 0, 0);
//}

//-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
//    [self.delegate collectionView:collectionView didSelectItemAtIndexPath:indexPath];
//    NSLog(@"%ld", indexPath.row);
//}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
